<template>
  <div class="all">
    <Nav :leftShow="left_show" :leftName="left_name" :rightName="right_name" :titleName="title_name">
    </Nav>
    <div class="quick">
      <p>快速备注</p>
      <div class="box">
        <div class="uls" v-for="(item,index) in text" :key="index">
          <NoteItem :tagArr="item" :mykey="index" />
        </div>
      </div>
    </div>
    <div class="other">
      <p>其他备注</p>
      <textarea name="" id="" cols="30" rows="10" class="content" placeholder="请输入备注内容（可不填）" v-model="other"></textarea>
    </div>
    <van-button type="primary" size="large" class="submit" @click="clickAction">确定</van-button>
  </div>
</template>
<script>
  import NoteItem from "@/components/NoteItem.vue"
  import Nav from "@/components/Nav.vue";
  export default {
    name: 'remark',
    data() {
      return {
        left_show: false,
        left_name: '空',
        title_name: '订单备注',
        right_name: '',
        text: [],
        selectIndex: 0,
        other: "",
      }
    },
    components: {
      NoteItem, Nav
    },
    methods: {
      change(i) {
        this.selectIndex = i;

      },
      clickAction() {
        this.$store.commit("remark", {
          key: 'other',
          value: this.other
        });
        // this.$router.push({ name: 'Order', params: { key: 0 } })
        this.$router.go(-1)
      }
    },
    created() {
      this.axios.get("https://elm.cangdu.org/v1/carts/1/remarks").then((res) => {
        this.text = res.data.remarks;
        // console.log(res.data.remarks)
      }).catch((err) => {
        console.log(err);
      });
    },
  }
</script>
<style lang="less" scoped>
  .all {
    width: 100%;
    height: 100%;
    background-color: rgb(245, 245, 245);
    margin-top: 44px;
  }

  .quick {
    width: 100%;
    background-color: white;
    padding-bottom: 10px;
    padding-left: 5px;
  }

  .uls {
    margin: 3px;
  }

  .content {
    border: none;
    width: 90%;
    height: 110px;
    margin-left: 5%;
    background-color: rgb(249, 249, 249);
    padding: 10px;
    font-size: 14px;
    box-sizing: border-box;
  }

  p {
    padding: 10px 0 10px 20px;
    font-size: 15px;
  }

  .box {
    display: flex;
    flex-wrap: wrap;
  }

  .other {
    width: 100%;
    height: 170px;
    background-color: white;
    margin-top: 10px;
  }

  .submit {
    width: 90%;
    margin-left: 5%;
    height: 40px;
    line-height: 40px;
    border-radius: 4px;
    background-color: rgb(76, 217, 100);
  }
</style>